Introduce Makefile config fragments for OS-specific differences.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 17 Oct 2006 15:48:05 +0000 (16:48 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 17 Oct 2006 15:48:05 +0000 (16:48 +0100)
Signed-off-by: John Levon <john.levon@sun.com>
Config.mk
Makefile
buildconfigs/Rules.mk
config/Linux.mk [new file with mode: 0644]
config/SunOS.mk [new file with mode: 0644]
config/x86_64.mk
xen/Rules.mk

index 92c829dede82903d956c258608495a3959af99d7..5154d4b1353a6e37e28841a80b3d1698b70268f1 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -4,43 +4,19 @@
 debug ?= n
 
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
-                                              -e s/ppc/powerpc/)
+                         -e s/ppc/powerpc/ -e s/i86pc/x86_32/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_TARGET_X86_PAE  ?= n
+XEN_OS              ?= $(shell uname -s)
 
 # Tools to run on system hosting the build
 HOSTCC     = gcc
 HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 
-AS         = $(CROSS_COMPILE)as
-LD         = $(CROSS_COMPILE)ld
-CC         = $(CROSS_COMPILE)gcc
-CPP        = $(CROSS_COMPILE)gcc -E
-AR         = $(CROSS_COMPILE)ar
-RANLIB     = $(CROSS_COMPILE)ranlib
-NM         = $(CROSS_COMPILE)nm
-STRIP      = $(CROSS_COMPILE)strip
-OBJCOPY    = $(CROSS_COMPILE)objcopy
-OBJDUMP    = $(CROSS_COMPILE)objdump
-
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
 
-INSTALL      = install
-INSTALL_DIR  = $(INSTALL) -d -m0755
-INSTALL_DATA = $(INSTALL) -m0644
-INSTALL_PROG = $(INSTALL) -m0755
-
-ifneq ($(debug),y)
-# Optimisation flags are overridable
-CFLAGS    ?= -O2 -fomit-frame-pointer
-CFLAGS    += -DNDEBUG
-else
-# Less than -O1 produces bad code and large stack frames
-CFLAGS    ?= -O1 -fno-omit-frame-pointer
-CFLAGS    += -g
-endif
-
+include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
 ifneq ($(EXTRA_PREFIX),)
@@ -50,6 +26,12 @@ endif
 
 test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep -q " $(2) " && echo $(2))
 
+ifneq ($(debug),y)
+CFLAGS += -DNDEBUG
+else
+CFLAGS += -g
+endif
+
 CFLAGS += -Wall -Wstrict-prototypes
 
 # -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
@@ -62,9 +44,6 @@ CFLAGS     += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
 
-# Choose the best mirror to download linux kernel
-KERNEL_REPO = http://www.kernel.org
-
 # If ACM_SECURITY = y, then the access control module is compiled
 # into Xen and the policy type can be set by the boot policy file
 #        y - Build the Xen ACM framework
index 186b7567659c66e39c6fc6c2480fff147648be80..c7004c0ae27cadda88340c60ea67ad4b1795b668 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,6 @@
 # Grand Unified Makefile for Xen.
 #
 
-KERNELS ?= linux-2.6-xen
-# You may use wildcards in the above e.g. KERNELS=*2.6*
-
-XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )
-
 # Export target architecture overrides to Xen and Linux sub-trees.
 ifneq ($(XEN_TARGET_ARCH),)
 SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH))
index 6eca30ef0a1248b22e36fa74093a167229c41a8e..ae61ea0095f46c240217005c8e7ee654aa328fdd 100644 (file)
@@ -3,6 +3,9 @@ include Config.mk
 
 export DESTDIR
 
+# Choose the best mirror to download linux kernel
+KERNEL_REPO = http://www.kernel.org
+
 ALLKERNELS = $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.*))
 ALLSPARSETREES = $(patsubst %-xen-sparse,%,$(wildcard *-xen-sparse))
 
diff --git a/config/Linux.mk b/config/Linux.mk
new file mode 100644 (file)
index 0000000..0e00d55
--- /dev/null
@@ -0,0 +1,34 @@
+# -*- mode: Makefile; -*-
+
+AS         = $(CROSS_COMPILE)as
+LD         = $(CROSS_COMPILE)ld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)ar
+RANLIB     = $(CROSS_COMPILE)ranlib
+NM         = $(CROSS_COMPILE)nm
+STRIP      = $(CROSS_COMPILE)strip
+OBJCOPY    = $(CROSS_COMPILE)objcopy
+OBJDUMP    = $(CROSS_COMPILE)objdump
+
+INSTALL      = install
+INSTALL_DIR  = $(INSTALL) -d -m0755
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -m0755
+
+LIB64DIR = lib64
+
+ifneq ($(debug),y)
+# Optimisation flags are overridable
+CFLAGS ?= -O2 -fomit-frame-pointer
+else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS ?= -O1 -fno-omit-frame-pointer
+endif
+
+# You may use wildcards, e.g. KERNELS=*2.6*
+KERNELS ?= linux-2.6-xen
+
+XKERNELS := $(foreach kernel, $(KERNELS), \
+              $(patsubst buildconfigs/mk.%,%, \
+                $(wildcard buildconfigs/mk.$(kernel))) )
diff --git a/config/SunOS.mk b/config/SunOS.mk
new file mode 100644 (file)
index 0000000..9acfc03
--- /dev/null
@@ -0,0 +1,27 @@
+# -*- mode: Makefile; -*-
+
+AS         = $(CROSS_COMPILE)gas
+LD         = $(CROSS_COMPILE)gld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)gar
+RANLIB     = $(CROSS_COMPILE)granlib
+NM         = $(CROSS_COMPILE)gnm
+STRIP      = $(CROSS_COMPILE)gstrip
+OBJCOPY    = $(CROSS_COMPILE)gobjcopy
+OBJDUMP    = $(CROSS_COMPILE)gobjdump
+
+INSTALL      = ginstall
+INSTALL_DIR  = $(INSTALL) -d -m0755
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -m0755
+
+LIB64DIR = lib/amd64
+
+ifneq ($(debug),y)
+# Optimisation flags are overridable
+CFLAGS ?= -O2 -fno-omit-frame-pointer
+else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS ?= -O1 -fno-omit-frame-pointer
+endif
index 82f7364d066b1f95e454cbf9545ef702bbf93c74..53883a6efccb6026822e34d5258434708d88d458 100644 (file)
@@ -6,4 +6,4 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 LDFLAGS += -m64
-LIBDIR = lib64
+LIBDIR = $(LIB64DIR)
index d3bdc92e885b56835382ff77c3f5481a7197c3dc..b3ae01dfc26b2005078d8e296bcc89d953effa99 100644 (file)
@@ -24,9 +24,11 @@ endif
 override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
 override TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
 override COMPILE_ARCH    := $(shell echo $(XEN_COMPILE_ARCH) | \
-                              sed -e 's/\(x86\|powerpc\).*/\1/')
+                              sed -e 's/x86.*/x86/' \
+                                  -e 's/powerpc.*/powerpc/')
 override TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                              sed -e 's/\(x86\|powerpc\).*/\1/')
+                              sed -e 's/x86.*/x86/' \
+                                  -e 's/powerpc.*/powerpc/')
 
 TARGET := $(BASEDIR)/xen